package com.miaosha.ms_03.util;
import org.apache.commons.codec.digest.DigestUtils;
/**
 * @Description //MD5工具类
 * @Author Administrator
 * @DATE 2020/9/16 21:19
 **/
public class MD5Util {

    private static final String SALT = "1a2b3c4d5e";

    private static String MD5(String value) {
        return DigestUtils.md5Hex(value);
    }

    private static String inputPassFrom(String str) {
        str = SALT.charAt(0) + str + SALT.charAt(1) + SALT.charAt(3) + SALT.charAt(5);
        return MD5(str);
    }

    public static String formToDB(String str,String salt) {
        str = salt.charAt(0) + str + salt.charAt(1) + salt.charAt(3) + salt.charAt(5);
        return MD5(str);
    }

    public static void main(String[] args) {
//        System.out.println(inputPassFrom("d3b1294a61a07da9b49b6e22b2cbd7f9"));
        System.out.println(formToDB(inputPassFrom("d3b1294a61a07da9b49b6e22b2cbd7f9"),"1a2b3c4d5e"));
    }
}
